/*     */ package com.zimbra.cs.service.formatter;
/*     */ 
/*     */ import com.zimbra.common.service.ServiceException;
/*     */ import com.zimbra.common.service.ServiceException.Argument;
/*     */ import com.zimbra.common.service.ServiceException.Argument.Type;
/*     */ import java.util.List;
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ 
/*     */ public class FormatterServiceException
/*     */   extends ServiceException
/*     */ {
/*     */   public static final String INVALID_FORMAT = "formatter.INVALID_FORMAT";
/*     */   public static final String INVALID_TYPE = "formatter.INVALID_TYPE";
/*     */   public static final String MISMATCHED_META = "formatter.MISMATCHED_META";
/*     */   public static final String MISMATCHED_SIZE = "formatter.MISMATCHED_SIZE";
/*     */   public static final String MISMATCHED_TYPE = "formatter.MISMATCHED_TYPE";
/*     */   public static final String MISSING_BLOB = "formatter.MISSING_BLOB";
/*     */   public static final String MISSING_META = "formatter.MISSING_META";
/*     */   public static final String MISSING_VCARD_FIELDS = "formatter.MISSING_VCARD_FIELDS";
/*     */   public static final String UNKNOWN_ERROR = "formatter.UNKNOWN_ERROR";
/*     */   public static final String FILE_NAME = "filename";
/*     */   public static final String ITEM_PATH = "path";
/*     */   public static final String ITEM_TYPE = "view";
/*     */   
/*     */   FormatterServiceException(String message, String code, boolean isReceiversFault, ServiceException.Argument... args)
/*     */   {
/*  44 */     super(message, code, isReceiversFault, args);
/*     */   }
/*     */   
/*     */   FormatterServiceException(String message, String code, boolean isReceiversFault, Throwable cause, ServiceException.Argument... args)
/*     */   {
/*  49 */     super(message, code, isReceiversFault, cause, args);
/*     */   }
/*     */   
/*     */   FormatterServiceException(String message, String code, boolean isReceiversFault, Throwable cause, List<ServiceException.Argument> args)
/*     */   {
/*  54 */     super(message, code, isReceiversFault, cause, args);
/*     */   }
/*     */   
/*     */   public static FormatterServiceException INVALID_FORMAT(String filename)
/*     */   {
/*  59 */     return new FormatterServiceException("invalid file format", "formatter.INVALID_FORMAT", false, new ServiceException.Argument[] { arg("filename", filename) });
/*     */   }
/*     */   
/*     */ 
/*     */   public static FormatterServiceException INVALID_TYPE(String view, String path)
/*     */   {
/*  65 */     return new FormatterServiceException("folder cannot contain item type " + view, "formatter.INVALID_TYPE", false, new ServiceException.Argument[] { arg("view", view), arg("path", path) });
/*     */   }
/*     */   
/*     */ 
/*     */   public static FormatterServiceException MISMATCHED_META(String path)
/*     */   {
/*  71 */     return new FormatterServiceException("mismatched item content and meta", "formatter.MISMATCHED_META", false, new ServiceException.Argument[] { arg("path", path) });
/*     */   }
/*     */   
/*     */ 
/*     */   public static FormatterServiceException MISMATCHED_SIZE(String path)
/*     */   {
/*  77 */     return new FormatterServiceException("ignored item data size mismatch", "formatter.MISMATCHED_SIZE", false, new ServiceException.Argument[] { arg("path", path) });
/*     */   }
/*     */   
/*     */   public static FormatterServiceException MISMATCHED_TYPE(String path)
/*     */   {
/*  82 */     return new FormatterServiceException("cannot overwrite non matching data", "formatter.MISMATCHED_TYPE", false, new ServiceException.Argument[] { arg("path", path) });
/*     */   }
/*     */   
/*     */ 
/*     */   public static FormatterServiceException MISSING_BLOB(String path)
/*     */   {
/*  88 */     return new FormatterServiceException("missing item blob for meta", "formatter.MISSING_BLOB", false, new ServiceException.Argument[] { arg("path", path) });
/*     */   }
/*     */   
/*     */   public static FormatterServiceException MISSING_META(String path)
/*     */   {
/*  93 */     return new FormatterServiceException("item content missing meta information", "formatter.MISSING_META", false, new ServiceException.Argument[] { arg("path", path) });
/*     */   }
/*     */   
/*     */ 
/*     */   public static FormatterServiceException MISSING_VCARD_FIELDS(String path)
/*     */   {
/*  99 */     return new FormatterServiceException("no contact fields found in vcard", "formatter.MISSING_VCARD_FIELDS", false, new ServiceException.Argument[] { arg("path", path) });
/*     */   }
/*     */   
/*     */ 
/*     */   public static FormatterServiceException UNKNOWN_ERROR(Throwable cause)
/*     */   {
/* 105 */     if ((cause instanceof ServiceException))
/* 106 */       return WRAPPED_EXCEPTION((ServiceException)cause);
/* 107 */     return new FormatterServiceException(cause.getMessage() == null ? cause.toString() : cause.getMessage(), "formatter.UNKNOWN_ERROR", true, cause, new ServiceException.Argument[0]);
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */   public static FormatterServiceException UNKNOWN_ERROR(String path, Throwable cause)
/*     */   {
/* 114 */     if ((cause instanceof ServiceException))
/* 115 */       return WRAPPED_EXCEPTION((ServiceException)cause);
/* 116 */     return new FormatterServiceException(cause.getMessage() == null ? cause.toString() : cause.getMessage(), "formatter.UNKNOWN_ERROR", true, cause, new ServiceException.Argument[] { arg("path", path) });
/*     */   }
/*     */   
/*     */ 
/*     */ 
/*     */ 
/*     */   private static FormatterServiceException WRAPPED_EXCEPTION(ServiceException e)
/*     */   {
/* 124 */     return new FormatterServiceException(e.getMessage(), e.getCode(), e.isReceiversFault(), e.getCause(), e.getArgs());
/*     */   }
/*     */   
/*     */   private static ServiceException.Argument arg(String name, String value)
/*     */   {
/* 129 */     return new ServiceException.Argument(name, value, ServiceException.Argument.Type.STR);
/*     */   }
/*     */ }


/* Location:              /home/mint/zimbrastore.jar!/com/zimbra/cs/service/formatter/FormatterServiceException.class
 * Java compiler version: 7 (51.0)
 * JD-Core Version:       0.7.1
 */